package br.com.amadeus.android.adapters;

import java.util.ArrayList;
import br.com.amadeus.android.activities.home.R;
import br.com.amadeus.android.entities.Goal;
import br.com.amadeus.android.entities.Resource;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class CourseInfoAdapter extends BaseAdapter {
	protected static final String CATEGORIA = "curso";
	private Context context;
	private ArrayList<Resource> resourceList;
	private ArrayList<Goal> goalList;
		
	public CourseInfoAdapter(Context context, ArrayList<Resource> resourceList, ArrayList<Goal> goalList) {
		super();
		this.context = context;
		this.resourceList = resourceList;
		this.goalList = goalList;
	}

	public int getCount() {
		// TODO Auto-generated method stub
		return 3;
	}

	public Object getItem(int posicao) {
		
		return null;
	}

	public long getItemId(int posicao) {
		// TODO Auto-generated method stub
		return posicao;
	}

	public View getView(int posicao, View convertView, ViewGroup vg) {			
		View v;
		if(convertView == null){
			LayoutInflater li = LayoutInflater.from(this.context);
			v = li.inflate(R.layout.course_info_detail, null);
			ImageView iv = (ImageView)v.findViewById(R.id.ivCourseInfoDetail);
			TextView tv = (TextView)v.findViewById(R.id.tvCourseInfoDetail);
			switch (posicao) {
			case 0:
				iv.setImageResource(R.drawable.alvo);
				tv.setText("Objetivos (" + this.goalList.size() + ")");
				break;
			case 1:
				iv.setImageResource(R.drawable.tarefas);
				tv.setText("Tarefas");
				break;
			case 2:
				iv.setImageResource(R.drawable.atividades);
				tv.setText("Recursos de Aprendizagem (" +  this.resourceList.size() +")");
				break;
			default:
				return v;
			}
		}
		else
		{
			v = convertView;
		}

		return v;

	}

}
